package io.renren.modules.study.entity;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class Event {
    private Long id;
    private String name;
    private List<StudyBaseSubject> subjects;

    public void addSubject(StudyBaseSubject subject) {
        if (subjects == null) {
            subjects = new ArrayList<>();
        }
        subjects.add(subject);
        subject.addEvent(this);
    }

    public void removeSubject(StudyBaseSubject subject) {
        if (subjects != null) {
            subjects.remove(subject);
            subject.removeEvent(this);
        }
    }
}
